package facade.open.response.base;

import models.base.AdminBusiness;
import models.base.AdminMenu;
import models.base.AdminUser;
import models.constants.DeletedStatus;

import java.util.Date;

/**
 * created by weiwei on 2018-02-23
 * 菜单、功能 返回信息
 */
public class AdminMenuResponse {

    /**
     * id
     */
    public String id;


    /**
     * 菜单编号
     */
    public String code;

    /**
     * 菜单名称
     */
    public String name;

    /**
     * Controller名称
     */
    public String title;


    /**
     * 页面请求地址
     */
    public String url;
    public String icon;
    public String parentId;
    /**
     * 排序号
     */
    public Integer showOrder;

    public String remark;

    public DeletedStatus deleted;
    /**
     * 创建时间.
     */
    public Date createdAt;

    /**
     * 创建人.
     */
    public AdminUser createUser;


    /**
     * 更新时间.
     */
    public Date modifyAt;

    /**
     * 修改人.
     */
    public AdminUser modifyUser;



    public static AdminMenuResponse from(AdminMenu menu){
        AdminMenuResponse response = new AdminMenuResponse();
        response.id = menu.id ;
        response.code = menu.code ;
        response.name = menu.name ;
        response.title = menu.title ;
        response.url = menu.url ;
        response.icon = menu.icon ;
        response.parentId = menu.parentId ;
        response.showOrder = menu.showOrder ;
        response.remark = menu.remark ;
        response.deleted = menu.deleted ;
        response.createUser = menu.createUser ;
        response.createdAt = menu.createdAt ;
        response.modifyAt = menu.modifyAt ;
        response.modifyUser = menu.modifyUser ;
        return response ;

    }

}
